#include "linear_translation.h"


void linear_trans_init(struct LINEAR_TRANS_T* trans, float x1, float y1, float x2, float y2)
{
    // we assume x1 != x2
    trans->k = (y1 - y2) / (x1 - x2);
    trans->b = y1 - trans->k * x1;
}

float linear_trans_calc(struct LINEAR_TRANS_T* trans, float x)
{
    float y = trans->k * x + trans->b;
    return y;
}
